﻿<UserControl x:Class="Profit.Controls.SlotsControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="31" d:DesignWidth="150">
    <UserControl.Resources>
        <Style x:Key="SlotTypeImageStyle" TargetType="{x:Type Image}">
            <Setter Property="Width" Value="26" />
            <Setter Property="Height" Value="26" />
            <Setter Property="VerticalAlignment" Value="Top"/>
            <Setter Property="HorizontalAlignment" Value="Left" />
        </Style>
        <Style x:Key="TextBlockStyle" TargetType="{x:Type TextBlock}">
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="Margin" Value="5,0,5,0"/>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
        </Grid.RowDefinitions>

        <Image Grid.Column="0" Grid.Row="0" Style="{StaticResource SlotTypeImageStyle}" Source="/Profit;component/Resources/Icons/turret_32.png" ToolTip="Turret slots count" />
        <Image Grid.Column="2" Grid.Row="0" Style="{StaticResource SlotTypeImageStyle}" Source="/Profit;component/Resources/Icons/launcher_32.png" ToolTip="Missile slots count" />
        <Image Grid.Column="4" Grid.Row="1" Style="{StaticResource SlotTypeImageStyle}" Source="/Profit;component/Resources/Icons/industrial_32.png" ToolTip="Industry slots count"  />
        <Image Grid.Column="6" Grid.Row="1" Style="{StaticResource SlotTypeImageStyle}" Source="/Profit;component/Resources/Icons/misc_32.png" ToolTip="Misc. slots count" />

        <TextBlock Grid.Column="1" Grid.Row="0" Style="{StaticResource TextBlockStyle}">
            <TextBlock.Text>
                <MultiBinding StringFormat="{}{0}/{1}">
                    <Binding Path="AvailableTurretSlotsCount" />
                    <Binding Path="TotalTurretSlotsCount" />
                </MultiBinding>
            </TextBlock.Text>
        </TextBlock>

        <TextBlock Grid.Column="3" Grid.Row="0" Style="{StaticResource TextBlockStyle}">
            <TextBlock.Text>
                <MultiBinding StringFormat="{}{0}/{1}">
                    <Binding Path="AvailableMissileSlotsCount" />
                    <Binding Path="TotalMissileSlotsCount" />
                </MultiBinding>
            </TextBlock.Text>
        </TextBlock>

        <TextBlock Grid.Column="5" Grid.Row="1" Style="{StaticResource TextBlockStyle}">
            <TextBlock.Text>
                <MultiBinding StringFormat="{}{0}/{1}">
                    <Binding Path="AvailableIndustrialSlotsCount" />
                    <Binding Path="TotalIndustrialSlotsCount" />
                </MultiBinding>
            </TextBlock.Text>
        </TextBlock>

        <TextBlock Grid.Column="7" Grid.Row="1" Style="{StaticResource TextBlockStyle}">
            <TextBlock.Text>
                <MultiBinding StringFormat="{}{0}/{1}">
                    <Binding Path="AvailableMiscellaneousSlotsCount" />
                    <Binding Path="TotalMiscellaneousSlotsCount" />
                </MultiBinding>
            </TextBlock.Text>
        </TextBlock>
        
    </Grid>
</UserControl>
